package Cpackage;

class Circle {
    protected double radius;

    public Circle(double radius) {
        this.radius = radius;
    }

    protected double computeArea() {
        return 3.14 * radius * radius;
    }
}

class Cylinder extends Circle {
    private double height;

    public Cylinder(double radius, double height) {
        super(radius); // 调用父类的构造函数
        this.height = height;
    }

    public double computeVolume() {
        return computeArea() * height; // 利用父类的computeArea方法
    }
}

public class Main {
    public static void main(String[] args) {
        Cylinder cylinder = new Cylinder(5, 10);
        System.out.println("圆柱体体积为：" + cylinder.computeVolume());
    }
}
